/************************************************************************
 * <br>
 * <ul>
 * <li>版权所有：唐山弘川科技有限公司 2009－2020</li>
 * <li>创建日期：2009-8-12</li>
 * <li>初始作者：刘川</li>
 * </ul>
 * <ul>
 * <b>修订历史</b>
 * <li>1、</li>
 * </ul>
 ***********************************************************************/
package com.hy.erp.inventory.pojo ;

import javax.persistence.Column ;
import javax.persistence.Entity ;
import javax.persistence.FetchType ;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne ;
import javax.persistence.OneToOne ;
import javax.persistence.PrimaryKeyJoinColumn ;
import javax.persistence.Table ;

import org.hibernate.annotations.Index ;

import com.hy.erp.inventory.dao.interfaces.IProvinceDao;
import com.hy.erp.inventory.dao.interfaces.IPutDepotTypeDao;
import com.hy.erp.inventory.pojo.interfaces.IProvince;
import com.hy.mydesktop.shared.persistence.domain.gxt.MyBaseModel;
//import com.hy.erp.inventory.vsoft.libra.enterprise.framework.persistence.api.annotation.DaoA;
//import com.hy.erp.inventory.vsoft.libra.enterprise.framework.persistence.entity.AbstractPersistentEntity;



/**
 * 
 * <ul>
 * <li>开发作者：李冰</li>
 * <li>设计日期：2010-10-6；时间：上午10:44:07</li>
 * <li>类型名称：Province</li>
 * <li>设计目的：省</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 */
@ Entity 
@Table(name="t_province")
//@Name("province")
//@DaoA(IProvinceDao.class)
//public class Province extends AbstractPersistentEntity implements IProvince
public class Province extends MyBaseModel //implements IPositonType
{
	private static final long	serialVersionUID	=
	                                                  - 8111789827407422559L ;


	/**
	 * 构造函数
	 */
	public Province ( )
	{
		super ( ) ;
	}


	


	/*@ OneToOne ( targetEntity = Country.class , fetch = FetchType.LAZY )
	@ PrimaryKeyJoinColumn
	public Country getCountry ( )
	{
		return this.get(IProvince.COUNTRY) ;
	}
	public void setCountry (
			Country country )
	{
	super.set(IProvince.COUNTRY,country) ;
	}*/
   

	@ Column ( name = "abbreviation" , length = 50)
	@ Index ( name = "abbreviationIndex" )
	public String getAbbreviation ( )
	{
		return this.get(IProvince.ABBREVIATION) ;
	}



	public void setAbbreviation (
									String abbreviation )
	{
		super.set(IProvince.ABBREVIATION,abbreviation) ;
	}


	@ Column ( name = "ancillaryCode" , length = 50)
	@ Index ( name = "ancillaryCodeIndex" )
	public String getAncillaryCode ( )
	{
		return this.get(IProvince.ANCILLARYCODE) ;
	}



	public void setAncillaryCode (
									String ancillaryCode )
	{
		super.set(IProvince.ANCILLARYCODE,ancillaryCode) ;
	}

	@ Column ( name = "description" , length = 200)
	@ Index ( name = "descriptionIndex" )

	public String getDescription ( )
	{
		return this.get(IProvince.DESCRIPTION) ;
	}



	public void setDescription (
									String description )
	{
		super.set(IProvince.DESCRIPTION,description) ;
	}
	/*@ Column ( name = "description" , length = 200)
	@ Index ( name = "descriptionIndex" )

	public byte [ ] getDescription ( )
	{
		return this.get(IProvince.DESCRIPTION) ;
	}



	public void setDescription (
									byte [ ] description )
	{
		super.set(IProvince.DESCRIPTION,description) ;
	}*/


	@ Column ( name = "name" , length = 50)
	@ Index ( name = "nameIndex" )
	public String getName ( )
	{
		return this.get(IProvince.NAME) ;
	}



	public void setName (
							String name )
	{
		super.set(IProvince.NAME,name) ;
	}


	@ Column ( name = "namedCode" , length = 50)
	@ Index ( name = "namedCodeIndex" )
	public String getNamedCode ( )
	{
		return this.get(IProvince.NAMECODE) ;
	}



	public void setNamedCode (
								String namedCode )
	{
		super.set(IProvince.NAMECODE,namedCode) ;
	}



	

	
//	@ManyToOne(targetEntity=LocationType.class,fetch=FetchType.EAGER)
	@ManyToOne
	@JoinColumn(name="locationType_identifier")
	//@PrimaryKeyJoinColumn
	public LocationType getLocationType ( )
		{
		return this.get(IProvince.LOCATIONTYPE) ;
		}

		public void setLocationType (
										LocationType locationType )
		{
			super.set(IProvince.LOCATIONTYPE,locationType) ;
			if (locationType!=null) {
				
				super.set(IProvince.LOCATIONTYPE_FOR_SHOW, locationType.getName());
			}

		}

	
		public String getLocationTypeForShow ( )
		{
			/*if (this.getLocationType().getName()==null) {
				
				return this.getLocationType().getName();
			} else {
				return this.get(IProvince.LOCATIONTYPE_FOR_SHOW) ;

			}*/
			if (this.get(IProvince.LOCATIONTYPE_FOR_SHOW)==null) {
				if (this.getLocationType()!=null) {
					
					return this.getLocationType().getName();
				} else {
					return null ;
				}
				
			} else {
				return this.get(IProvince.LOCATIONTYPE_FOR_SHOW) ;

			}
		}

		public void setLocationTypeForShow(String locationTypeForShow) {
			/*if (locationTypeForShow==null) {
				
				super.set(IProvince.LOCATIONTYPE_FOR_SHOW, locationTypeForShow);
			}else {
				
				super.set(IProvince.LOCATIONTYPE_FOR_SHOW, this.getLocationType().getName());
			}*/
			super.set(IProvince.LOCATIONTYPE_FOR_SHOW, locationTypeForShow);

		}
		

		

}
